﻿using Kw.Combinatorics;
using System;
using System.Linq;

namespace Kw.CombinatoricsExamples
{
    // Subclassing is one way to get user-friendly output:
    public class NumberText : Permutation
    {
        static string[] text = { "one", "two", "three" };

        public NumberText () : base (text.Length)
        { }

        public override string ToString ()
        {
            return String.Join  (" ", from ei in this select text[ei]);
        }
    }

    class PnExample02
    {
        static void Main ()
        {
            foreach (var row in new NumberText().GetRowsForAllWidths())
                Console.WriteLine (row);
        }

        /* Output:

        one
        one two
        two one
        one two three
        one three two
        two one three
        two three one
        three one two
        three two one

        */
    }
}
